Typed Transformations of Typed Grammars: The Left Corner Transform

نویسندگان

  • Arthur I. Baars
  • S. Doaitse Swierstra
  • Marcos Viera
چکیده

One of the questions which comes up when using embedded domain specific languages is to what extent we can analyze and transform embedded programs, as normally done in more conventional compilers. Special problems arise when the host language is strongly typed, and this host type system is used to type the embedded language. In this paper we describe how we can use a library, which was designed for constructing transformations of typed abstract syntax, in the removal of left recursion from a typed grammar description. The algorithm we describe is the Left-Corner Transform, which is small enough to be fully explained, involved enough to be interesting, and complete enough to serve as a tutorial on how to proceed in similar cases. The described transformation has been successfully used in constructing a compositional and efficient alternative to the standard Haskell read function.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Dependently Typed Grammars

Parser combinators are a popular tool for designing parsers in functional programming languages. If such combinators generate an abstract representation of the grammar as an intermediate step, it becomes easier to perform analyses and transformations that can improve the behaviour of the resulting parser. Grammar transformations must satisfy a number of invariants. In particular, they have to p...

متن کامل

Compact non-left-recursive grammars using the selective left-corner transform and factoring

The left-corner transform removes left-recursion from (probabilistic) context-free grammars and unication grammars, permitting simple top-down parsing techniques to be used. Unfortunately the grammars produced by the standard left-corner transform are usually much larger than the original. The selective left-corner transform described in this paper produces a transformed grammar which simulates...

متن کامل

Overview of Formal Concepts for Model Transformations Based on Typed Attributed Graph Transformation

In this paper we give an overview of formal concepts for model transformations between visual languages based on typed attributed graph transformation. We start with a basic concept where visual languages are defined by attributed type graphs only and model transformations by basic typed attributed graph transformation systems. We continue with different kinds of extensions of the basic concept...

متن کامل

The Comparison of Typed and Handwritten Essays of Iranian EFL Students in terms of Length, Spelling, and Grammar

This study attempted to compare typed and handwritten essays of Iranian EFL students in terms of length, spelling, and grammar. To administer the study, the researchers utilized Alice Touch Typing Tutor software to select 15 upper intermediate students with higher ability to write two essays: one typed and the other handwritten. The students were both males and females between the ages of 22 to...

متن کامل

Left Corner Transforms and Finite State Approximations

This paper describes methods for approximating context-free grammars with finite state machines. Unlike the method derived from the LR(k) parsing algorithm described in Pereira and Wright (1991), these methods use grammar transformations based on the left-corner grammar transform (Rosenkrantz and Lewis II, 1970; Aho and Ullman, 1972). One advantage of the left corner methods is that they genera...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:
  • Electr. Notes Theor. Comput. Sci.

دوره 253  شماره 

صفحات  -

تاریخ انتشار 2010